/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.market.web.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ps
 */
@Entity
@Table(name = "orderdetails")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Orderdetails.findAll", query = "SELECT o FROM Orderdetails o"),
    @NamedQuery(name = "Orderdetails.findByOrderDetailsId", query = "SELECT o FROM Orderdetails o WHERE o.orderDetailsId = :orderDetailsId"),
    @NamedQuery(name = "Orderdetails.findByOrderQty", query = "SELECT o FROM Orderdetails o WHERE o.orderQty = :orderQty"),
    @NamedQuery(name = "Orderdetails.findByProductName", query = "SELECT o FROM Orderdetails o WHERE o.productName = :productName")})
public class Orderdetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "OrderDetailsId")
    private Integer orderDetailsId;
    @Column(name = "OrderQty")
    private Integer orderQty;
    @Size(max = 45)
    @Column(name = "ProductName")
    private String productName;
    @JoinColumn(name = "Pid", referencedColumnName = "Pid")
    @ManyToOne
    private Inventory pid;
    @JoinColumn(name = "OrderId", referencedColumnName = "OrderId")
    @ManyToOne
    private Order1 orderId;

    public Orderdetails() {
    }

    public Orderdetails(Integer orderDetailsId) {
        this.orderDetailsId = orderDetailsId;
    }

    public Integer getOrderDetailsId() {
        return orderDetailsId;
    }

    public void setOrderDetailsId(Integer orderDetailsId) {
        this.orderDetailsId = orderDetailsId;
    }

    public Integer getOrderQty() {
        return orderQty;
    }

    public void setOrderQty(Integer orderQty) {
        this.orderQty = orderQty;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public Inventory getPid() {
        return pid;
    }

    public void setPid(Inventory pid) {
        this.pid = pid;
    }

    public Order1 getOrderId() {
        return orderId;
    }

    public void setOrderId(Order1 orderId) {
        this.orderId = orderId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (orderDetailsId != null ? orderDetailsId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Orderdetails)) {
            return false;
        }
        Orderdetails other = (Orderdetails) object;
        if ((this.orderDetailsId == null && other.orderDetailsId != null) || (this.orderDetailsId != null && !this.orderDetailsId.equals(other.orderDetailsId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.market.web.model.Orderdetails[ orderDetailsId=" + orderDetailsId + " ]";
    }
    
}
